package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenRelationSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerRelationAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.carrier.Relation;
import com.wlyuan.open.scanner.repository.RelationRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.RELATION)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerRelationHandler extends BaseScannerHandler<Relation, OpenRelationSyncDTO> {
    private final RelationRepository relationRepository;

    @Override
    protected List<Relation> select() {
        return relationRepository.getRelationList();
    }

    @Override
    protected List<OpenRelationSyncDTO> assembler(List<Relation> data) {
        return ScannerRelationAssembler.assemble(data);
    }
}
